package dao.impl;

import dao.TypeDao;
import entity.Type;
import entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;

/**
 * @version 1.0
 * @Author: xxf
 * @CreateDate: 2020/9/30 14:12
 */
public class TypeDaoImpl implements TypeDao {

    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public List<Type> selectAll() {

        String sql = "select t_id as tid,t_name tname,t_info as tinfo from type limit 6";
        List<Type> list = template.query(sql, new BeanPropertyRowMapper<Type>(Type.class));


        return list;
    }
}
